package club.lovety.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author smc
 * @date 2019-01-03 17:07
 * @since
 **/
public class OneServlet extends HttpServlet {

    @Override
    public void init(ServletConfig config) throws ServletException {
      String application =   config.getInitParameter("applicaiton");
        System.out.println("applicaiton: "+ application);
        super.init(config);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


        System.out.println("servlet----get");
        resp.getOutputStream().write("servlet---get".getBytes());
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("servlet----post");
        resp.getOutputStream().write("servlet---post".getBytes());
    }
}
